"use strict";
cc._RF.push(module, '0a698V3iYxMTK6R5OUcNlzg', 'GatlinBullet');
// scripts/GatlinBullet.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GameConstant"),
    s = t("Util"),
    l = t("Global"),
    c = t("GatlinHitEffect"),
    d = cc._decorator,
    h = d.ccclass,
    p = d.property,
    u = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.collider = null, e.pfb_hitEff = null, e.speed = 0, e.degree = 0, e.destroyBullet = function () {
      this.node.opacity = 0, s.Util.objectPool.putNodeIntoNodePool(l.PoolKey.gatlinBullet, this.node);
    }, e;
  }

  return n(e, t), e.prototype.initItem = function (t, e, o, i, n) {
    this.degree = n / 180 * Math.PI, this.node.opacity = 255, this.node.position = i, this.node.angle = n, this.speed = 2e3, this.collider.tag = t, this.setScale(e == r.Collide_Car_Tag.Right, o), this.scheduleOnce(this.destroyBullet, 1);
  }, e.prototype.getColliderWeaponTag = function (t) {
    return t % 100;
  }, e.prototype.setScale = function (t, e) {
    var o = 1;
    o = r.Cur_Game_Type == r.Game_Type.PK ? r.Game_Type_Scale.PK : 1, o = e < 0 ? -o : o, this.node.scale = t ? -o : o;
  }, e.prototype.update = function (t) {
    this.node.scaleX >= 0 ? (this.node.x += this.speed * t * Math.cos(this.degree), this.node.y += this.speed * t * Math.sin(this.degree)) : (this.node.x -= this.speed * t * Math.cos(this.degree), this.node.y -= this.speed * t * Math.sin(this.degree));
  }, e.prototype.removeItem = function (t) {
    if (null != this.node && null != this.node.parent) {
      var e = this.node.parent.convertToNodeSpaceAR(t),
          o = s.Util.objectPool.getNodeFromNodePool(l.PoolKey.gatlinhiteff, this.pfb_hitEff);
      this.node.parent.addChild(o), o.position = cc.v3(e.x, e.y, 0), o.getComponent(c["default"]).init(), s.Util.respownStarParticle(t, s.Util.getRandomInt(4, 6)), this.unschedule(this.destroyBullet), s.Util.objectPool.putNodeIntoNodePool(l.PoolKey.gatlinBullet, this.node);
    }
  }, a([p(cc.Collider)], e.prototype, "collider", void 0), a([p(cc.Prefab)], e.prototype, "pfb_hitEff", void 0), a([h], e);
}(cc.Component);

o["default"] = u;

cc._RF.pop();